var server = require('../bin/www');
var app = server.app;
var request = require('supertest');
var should = require('should');

suite('express-route-unit-tests', function () {
    test('.get("/req", callback)', function (done) {
        request(app)
            .get('/req')
            .set('accept', 'application/json')
            .expect(200)
            .end(function (err, res) {
                var headers = res.headers;
                headers.should.have.property('content-type', 'application/json; charset=utf-8');
                var body = res.body;
                body.should.not.property('app');
                body.should.have.property('baseUrl').be.empty();
                body.should.have.property('body').be.empty();
                body.should.have.property('cookies').be.empty();
                body.should.have.property('fresh').be.false();
                body.should.have.property('hostname').be.eql('127.0.0.1');
                body.should.have.property('ip').be.eql('::ffff:127.0.0.1');
                body.should.have.property('ips').be.empty();
                body.should.have.property('originalUrl').be.eql('/req');
                done();
            });
    });

    test('.get("/res", callback)', function (done) {
        request(app)
            .get('/res')
            .set('accept', 'application/json')
            .expect(200, function (res) {
                done();
            });
    });
});